package uet.sort;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class ChooseAlgorithmSortActivity extends Activity implements
		OnClickListener {

	private static final int SELECTIONSORT = R.id.algorithm1;
	private static final int QUICKSORT = R.id.algorithm2;
	private static final int SHELLSORT = R.id.algorithm3;
	Button selectionSort, quickSort, shellSort;

	/*
	 * (non-Javadoc)
	 * 
	 * @see android.app.Activity#onCreate(android.os.Bundle)
	 */
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_choose_algorithm_sort);
		selectionSort = (Button) findViewById(SELECTIONSORT);
		quickSort = (Button) findViewById(QUICKSORT);
		shellSort = (Button) findViewById(SHELLSORT);
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		selectionSort.setOnClickListener(this);
		quickSort.setOnClickListener(this);
		shellSort.setOnClickListener(this);
	}

	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub
		Intent intentNumberOfAlg = new Intent("uet.sort.NUMBEROFSORTING");
		Bundle bundle = new Bundle();
		switch (arg0.getId()) {
		case SELECTIONSORT:
			bundle.putInt("ALGORITHM", SELECTIONSORT);
			intentNumberOfAlg.putExtras(bundle);
			startActivity(intentNumberOfAlg);
			break;
		case QUICKSORT:
			bundle.putInt("ALGORITHM", QUICKSORT);
			intentNumberOfAlg.putExtras(bundle);
			startActivity(intentNumberOfAlg);
			break;
		case SHELLSORT:
			bundle.putInt("ALGORITHM", SHELLSORT);
			intentNumberOfAlg.putExtras(bundle);
			startActivity(intentNumberOfAlg);
			break;
		default:
			break;
		}

	}

}
